package DemoList;

public class Test {
    public static void main(String[] args) {
        MySingleList mySingleList  = new MySingleList();
        mySingleList.addFirst(1);
        mySingleList.addFirst(2);
        mySingleList.addFirst(3);
        mySingleList.addFirst(4);
        mySingleList.addFirst(5);
        mySingleList.show();
        MySingleList.ListNode K = mySingleList.findKLast1(6);
        System.out.println(K.val);
    }
    public static void main3(String[] args) {
        MySingleList mySingleList  = new MySingleList();
        mySingleList.addFirst(1);
        mySingleList.addFirst(2);
        mySingleList.addFirst(3);
        mySingleList.addFirst(4);
        mySingleList.addFirst(5);
        mySingleList.show();
        MySingleList.ListNode tmp = mySingleList.findMiddleNode1();
        mySingleList.show();
        System.out.println(tmp.val);
    }
    public static void main2(String[] args) {
        MySingleList mySingleList  = new MySingleList();
        mySingleList.addFirst(1);
        mySingleList.addFirst(2);
        mySingleList.addFirst(3);
        mySingleList.addFirst(4);
        mySingleList.show();
        mySingleList.reverseList();
        mySingleList.show();
    }
    public static void main1(String[] args) {
        MySingleList mySingleList = new MySingleList();
        mySingleList.createNode();
        mySingleList.show();
        System.out.println(mySingleList.size());
        //判断是否含有11
        if(mySingleList.contains(11)) {
            System.out.println("含有11");
        }
        //头插
        mySingleList.addFirst(1);
        mySingleList.addFirst(66);
        //尾插
        mySingleList.addLast(66);
        mySingleList.addLast(66);
        mySingleList.addLast(66);
        mySingleList.show();
        //在指定位置插入指定元素
        mySingleList.addIndex(3,333);
        mySingleList.show();
        //删除第一个6
        mySingleList.remove(6);
        mySingleList.show();
        //删除全部66
        mySingleList.removeAll(66);
        mySingleList.show();
//        //删除全部数据
//        mySingleList.clear();
//        mySingleList.show();
        //反转链表
        mySingleList.reverseList();
        mySingleList.show();
    }
}
